//https://api.dartlang.org/stable/2.2.0/dart-convert/Utf8Codec-class.html
import "dart:convert";

main() {
  Utf8Codec utf8 = new Utf8Codec();
  
  //方法

  //encode(String input) → List<int> --把字符串转成utf-8编码
  List hello = utf8.encode("hello");
  print('hello--'+ hello.toString());//hello--[104, 101, 108, 108, 111]
  print(hello.runtimeType);//Uint8List

  //decode(List<int> codeUnits, { bool allowMalformed }) → String   --把utf-8编码转成字符串
  String str= utf8.decode([104, 101, 108, 108, 111]);
  print(str);//hello
}
